package _const

import (
	"time"

	ut "github.com/go-playground/universal-translator"
	"github.com/go-playground/validator/v10"
)

var (
	Validate          = validator.New()
	Trans             ut.Translator
	StreamCallBackKey string
	SwagIsEnable      bool
)

const (
	OPENSSL_KEY = "meet\u0000\u0000\u0000\u0000" //php的key不夠長會自動補NUL\0
	POWER_CODE  = "9999"

	CONN_TIMEOUT_MS   = 5000
	SERVE_TIMEOUT_MS  = 10000
	FORCE_PAY_CODE    = "FORCEPAY"
	REDIS_LIVE_ANCHOR = "LIVING:%d" //聊天室用

	REDIS_LIVE_BANNER_LIST   = "BANNERLIST:%d"
	REDIS_HOME_CACHE         = "HOMECACHE:%s"
	REDIS_GIFTLIST_CACHE     = "GIFTLIST:"
	REDIS_USER_TOKEN         = "USER:TOKEN:{%d}"     //ios 安卓
	REDIS_USER_TOKEN_WEB     = "USER:TOKEN_WEB:{%d}" //web
	REDIS_USER_TOKEN_ExpTime = 7776000               // 90天
	REDIS_USER_LAST_TOKEN    = "USER:LAST:TOKEN:%d"
	REDIS_USER_INFO          = "USER:INFO:%d"
	REDIS_USER_LEVEL_RULE    = "USER:LEVEL:RULE"
	REDIS_ANCHOR_LEVEL_RULE  = "ANCHOR:LEVEL:RULE"
	REDIS_USER_EVERYDAYTASK  = "USER:EVERYDAYTASK:%d_%d"
	REDIRECT_CACHE           = 301
	REDIRECT                 = 302
	REDIS_DEFAULT_AVATAR     = "DEFAULT:AVATAR"
	REDIS_USER_FULL_INFO     = "USER:FULLINFO:%d"

	REDIS_ROOM_GUESS_STATUS      = "REDIS_ROOM_%d"
	REDIS_ROOM_GUESS_LAST_STATUS = "REDIS_ROOM_LAST:%d:%d" //主播id:liveId
	REDIS_ROOM_ONLINE_USERS      = "ROOM_ONLINE_USERS:%d"  // 房间 当前在线 用户 id 列表, params: anchorId.

	REDIS_USERS_GIFT                = "USER:GIFT:%d:%d"   //用户发某个礼物的计数
	REDIS_USERS_LAST_GIFT           = "USER:GIFT:LAST:%d" //用户上次发的礼物是啥
	REDIS_ADVERTISE                 = "LIVEADVERTISE"     //平台广告数据
	REDIS_HOME_BANNER_BG            = "HOME_BANNER_BG"    //web首页背景
	REDIS_IS_ANCHOR                 = "IS_ANCHOR:%d"      //记录某id是主播
	REDIS_GIFT_MAP                  = "GIFT:MAP"          //所有有效的礼物的列表
	REDIS_NOBLE                     = "REDIS_NOBLE:%d"
	REDIS_LAST_ANO_MSG_TIME         = "REDIS:LAST:ANO:%d"     //最后一次推匿名用户登陆的消息,后面带房间号
	REDIS_LAST_WELCOME_TIME         = "REDIS:LAST:WELCOME:%d" //最后一次推*普通*用户登陆的消息,后面带房间号
	REDIS_LiveRoom_InOut_Statistics = "LiveRoom_InOut_Statistics:"

	REDIS_CHECK_MAINTAIN = "CHECK_MAINTAIN"

	USER_IP_SOURCE = "STAT:USER_IP_SOURCE:%s"

	REDIS_USER_BINDACCOUNT_COUNT = "USER:BINDACCOUNT:COUNT:%d" //绑定6T账号
)

// 终日统计缓存 // %s%d%d 日，用户id,渠道id
const (
	// 订阅
	STAT_USER_REGISTER_CHANNEL       = "STAT_USER_REGISTER_CHANNEL"
	STAT_USER_REGISTER_CHANNEL_GROUP = "STAT_USER_REGISTER_CHANNEL.GROUP"
	STAT_USER_LOGIN_CHANNEL          = "STAT_USER_LOGIN_CHANNEL"
	STAT_USER_LOGIN_CHANNEL_GROUP    = "STAT_USER_LOGIN_CHANNEL.GROUP"
	STAT_USER_NEXTDAY_CHANNEL        = "STAT_USER_NEXTDAY_CHANNEL"
	STAT_USER_VALID_CHANNEL          = "STAT_USER_VALID_CHANNEL"
	STAT_USER_VALID_CHANNEL_GROUP    = "STAT_USER_VALID_CHANNEL.GROUP"
	STAT_USER_ACTIVE_CHANNEL         = "STAT_USER_ACTIVE_CHANNEL"
	STAT_USER_ACTIVE_CHANNEL_GROUP   = "STAT_USER_ACTIVE_CHANNEL.GROUP"

	// REDIS_STAT_USER_REGISTER = "STAT:USER:LOGIN:%s:%d:%d"   // 当天注册
	REDIS_STAT_USER_LOGIN   = "STAT:USER:LOGIN:%s:%d:%s"   // 当天登录
	REDIS_STAT_USER_NEXTDAY = "STAT:USER:NEXTDAY:%s:%d:%s" // 次日登录留存
	REDIS_STAT_USER_VALID   = "STAT:USER:VALID:%s:%d:%s"   // 有效用户
	REDIS_STAT_USER_ACTIVE  = "STAT:USER:ACTIVE:%s:%d:%s"  // 活跃用户
	REDIS_FOLLOW_COUNTER    = "FOLLOW:%d:%d"               //前者关注了后者
	FOLLOW_LIMIT_TIME       = 6                            //一天关注三次

)

type PayMethod struct {
	ReqUrl  string
	Mid     string
	Account string
	Key     string
	Secret  string
	Code    string
	Params  string
}

// 活动开启(0关 1开)
const (
	StartRegActivity        = 1
	StartFistChargeActivity = 0
	StartInviteActivity     = 0
)

// 订阅频道
const (
	WebapiStreamChannel     = "webapiStreamChannel"
	ChatRecordChannel       = "JetStream.ChatRecordSubject"
	ChatRecordDeleteChannel = "JetStream.ChatRecordDelete"
	SendGiftChannel         = "JetStream.SendGiftSubject"
	ClearChatChannel        = "JetStream.ClearChatSubject"

	AttentAnchorChannel       = "attentAnchorChannel"
	ChangePropChannel         = "changePropChannel"
	AccountFundsRecordChannel = "Account.FundsRecord" //Account.* 账户、财务相关的频道
	AccountGiftLogChannel     = "Account.GiftLog"     //Account.* 账户、财务相关的频道
	AccountUserLogChannel     = "Account.LoginLog"    //Account.* 账户、财务相关的频道

	CHATRECORDCHANNEL_GROUP         = "JetStream.ChatRecordSubject.group"
	SENDGIFTCHANNEL_GROUP           = "JetStream.SendGiftSubject.group"
	ACCOUNTFUNDSRECORDCHANNEL_GROUP = "Account.FundsRecord.group" //Account.* 账户、财务相关的频道
	ACCOUNTGIFTLOGCHANNEL_GROUP     = "Account.GiftLog.group"     //Account.* 账户、财务相关的频道
	IM_GROUP                        = "IM_GROUP"

	MQ_EXCHANGE_LIVE_GIFT  = "live.gift"
	MQ_QUEUE_LIVE_GIFT     = "live.gift"
	MQ_ROUTE_KEY_LIVE_GIFT = "gift"
	MQ_FAIL_RETRY_TIME     = 3 //失败重试次数

	ACCOUNTUSERLOGCHANNEL_GROUP = "Account.LoginLog.group" //Account.* 账户、财务相关的频道

	GuessOrderChannel = "Guess.Order" //Account.* 账户、财务相关的频道
	WsMsgChannel      = "live_stream" //这个是和chat room交互的频道

	FundsFLow2ESChannel = "JetStream.FundsFLow2ESChannel"
	SensitiveChannel    = "pubConf.DirtyWords"

	TASK_EVENT_CHANNEL_GROUP = "Task.Event.group" //Account.* 账户、财务相关的频道
	TASK_EVENT_CHANNEL       = "Task.Event"       //Account.* 账户、财务相关的频道

	ACTIVITY_EVENT_CHANNEL_GROUP = "Activity.Event.group" //Account.* 活动相关的频道
	ACTIVITY_EVENT_CHANNEL       = "Activity.Event"       //Account.* 活动相关的频道

	IM_ALL_MEMBER_PUSH = "IM.all_member_push" //IM全員推送
)

type FundsType uint8

// 货币类型
const (
	CoinGold       FundsType = 1 //钻石
	CoinDiamond    FundsType = 2 //宝石
	CoinExperience FundsType = 3 //经验
)

// 礼物类型
const (
	OrdinaryGiftType  = 0 //钻石计费
	LuxuryGiftType    = 1 //宝石计费
	ActivityGiftType  = 2 //活动礼物
	GIFTTYPE_ORDINARY = 0 //普通礼物
	GIFTTYPE_LUXURY   = 1 //豪华礼物
)

type TaskType uint8

const (
	EVERY_DAY_TASK  = TaskType(iota) //0-日常任务
	NEW_USER_TASK                    //1-新手任务
	LIMIT_TIME_TASK                  //2-限时任务
	CHECK_IN_TASK                    //3-签到奖励任务
)

type TaskId int

const (
	TASK_NEWBIE_N_GIFT    = 9  //新手-送出n个礼物
	TASK_DAILY_SUB_ANCHOR = 10 //每日-完成订阅N个主播
	TASK_DAILY_CHAT       = 11 //每日-完成发送n条弹幕
	TASK_SET_NICKNAME     = 16 //首次-设置昵称 16
)
const (
	Task_NONE = TaskId(iota)
	//----------------------------------
	TASK_SIGN_IN_EVERYDAY        //每日-登录APP 1
	TASK_CHARGE_DIAMOND_EVERYDAY //每日-充值克拉 2 *2022Aug11未开通
	TASK_SIGN_UP                 //首次-注册成功 3
	TASK_SIGN_IN_APP             //首次-登录APP 4
	TASK_SET_PASSWORD            //首次-设置登录密码 5
	TASK_SET_AVATAR              //首次-设置头像 6

	TASK_FIRST_CHARGE_DIAMOND //首次-充值克拉 7 *2022Aug11未开通
	TASK_BIND_NAME            //首次-绑定真实姓名 8 *2022Aug11未开通
	//-----------------------------------------
	ONLIVE1         //开播时间1
	ONLIVE2         //开播时间2
	ONLIVE3         //开播时间3
	SHARE_LIVEROOM1 //分享直播间1
	SHARE_LIVEROOM2 //分享直播间2
	SHARE_LIVEROOM3 //分享直播间3
	ATTENT_ANCHOR1  //订阅主播1
	MESSAGE_BARRAGE //发弹幕
	ATTENT_ANCHOR2  //订阅主播2
	ANCHOR_GIFT     //给主播送礼
	ATTENT_ANCHOR3  //订阅主播3
	INVITE_SIGN_UP1 //邀请好友注册1
	INVITE_SIGN_UP2 //邀请好友注册2
	WATCH_LIVE1     //观看直播条件1
	WATCH_LIVE2     //观看直播条件2
	WATCH_LIVE3     //观看直播条件3
)

// 直播动画
const (
	BasketBallAnimationAppUrl = "https://tracker.namitiyu.com/zh/basketball?profile=gA2rIqu8GFDHb&id=%d" // (pc版跟移动端分开)3705742
	BasketBallAnimationUrl    = "https://tracker.namitiyu.com/zh/basketball?profile=gA2rIqu8GFDHb&id=%d"
	FootBallAnimationUrl      = "https://tracker.namitiyu.com/zh/football?profile=yADdIyHoruqHP&id=%d"
	CricketAnimationUrl       = "https://widgets.thesports01.com/en/cricket?profile=9emo3cypzhluymd&id=%d"
)

// 单个红包常用常量定义
const (
	HONGBAO_LOW_PRICE                   = 10
	HONGBAO_SHOW_TIME                   = 10 * 60                           //10分钟
	DEFALUT_DELAYTIME                   = 3 * 60                            //3分钟
	HONG_BAO_CACHE_EXPIRED_TIME         = 50 * 60                           //50分钟
	HONG_BAO_USER_GRAB_KEY_EXPIRED_TIME = 50 * 60                           //50分钟
	HONG_BAO_DIAMOND_CACHE_REDIS_KEY    = "HONG_BAO:DIAMOND_CACHE{hongBao}" //红包q金额缓存前缀
	HONG_BAO_CACHE_REDIS_KEY            = "HONG_BAO:CACHE{hongBao}"         //红包缓存前缀
	HONG_BAO_USER_CACHE_REDIS_KEY       = "HONG_BAO:USER_CACHE{hongBao}"    //红包用户缓存前缀
	HONGBAO_DEALT                       = "HONG_BAO:DEALT{hongBao}"         //死信队列，从未有插入到记录到缓存中的红包.记录一下
	RETRY_TIME                          = 3                                 //保存到数据库失败并重试
	RETRY_TIME_SLEEP                    = 80                                //重试的间隔时间设置为80腊秒
	SEARCH_BEFORE_TIME                  = 10 * 60 * 60                      //10个小时之前
	BACK_HONG_BACK_POLLING_TIME         = 10                                //每秒执行一次
	HONG_BAO_BATCH_SIZE                 = 1000                              // 批量提交到数据库的大小
	HONG_BAO_COMMIT_TICKER              = 200                               //轮循时间间隔
	HONG_BAO_COMMIT_FAIL_INTERVAL       = 50                                //红包提交失败时间轮循间隔
)

type CallInfo struct {
	PackageName string
	FileName    string
	FuncName    string
	Line        int
}

/*
*

	rpc 远程调用中 错误自定义代码
*/
const (
	RPC_FAILED             = 1 //失败
	RPC_REPEAT_PAY         = 3 //重复支付
	RPC_SUCCEED            = 0 //成功
	RPC_BALANCE_NOT_ENOUGH = 2 //余额不足
)

/*
*

	有料中资料余额不足自定义ERROR 可用于余额操作中的自定义ERROR
*/

/*
*
分页 默认值
*/
const (
	LIST_SIZE_DEFAULT = 10 //分页默认值
	LIST_PAGE_DEFAULT = 1  //默认是第一页
)

const (
	FEE_TYPE_FREE    = 0 //免费
	FEE_TYPE_GOLD    = 1 //钻石
	FEE_TYPE_DIAMOND = 2 //宝克
	FEE_IS_PAY       = 1 //已支付
	FEE_NOT_PAY      = 0 // 未支付
)

/*
*
空串
*/
const EMPTY_STR = ""
const INCL_EMPTY_STR = " "

/*
*

	http 请求头中常用的请求变量
*/
const (
	HTTP_KEY_UID   = "uid"
	HTTP_KEY_BODY  = "body"
	HTTP_KEY_TOKEN = "token"
)

/*
*

	http响应消息常用MSG KEY
*/
const (
	HTTP_RESP_MSG_SUC  = "success"
	HTTP_RESP_MSG_FAIL = "fail"
)

/*
*

	钱包中更新余额中是否需要查询更新后的余额
*/
const (
	WALLET_BALANCE_SHOW = 1 //需要查询更新后的余额
	WALLET_BALANCE_HIDE = 0 //不需要查询更新后的余额
)

const (
	SPORT_SPORT_ID_DEAULT    = 0
	SPORT_MENU_TITLE_ALL     = "所有"
	SPORT_MENU_TITLE_ALL_PIC = ""
	SPORT_MENU_TITLE_HOT     = "热门"
	SPORT_MENU_TITLE_HOT_PIC = ""
	SPROT_DONE_MATCH_STATUS  = 3

	SPORT_MENU_COMP_KEY           = "SPORT_MENU_COMP_KEY_1"     //赛事列表菜单缓存KEY
	SPORT_MENU_COMP_FOR_MATCH_KEY = "SPORT_MENU_COMP_FOR_MATCH" //赛事列表缓存key
	SPORT_MENU_COMP_EXPIRY_KEY    = 12 * 60 * 60                //12小时

	SPORT_HOT_INDEX_KEY          = "SPORT_HOT_INDEX_KEY"   //首页热门赛事列表
	SPORT_HOT_INDEX_EXPIRY_KEY   = 20                      //首页热门赛事缓存20秒
	SPORT_MATCH_INDEX_KEY        = "SPORT_MATCH_INDEX_KEY" //首页赛事列表缓存KEY
	SPORT_MATCH_INDEX_EXPIRY_KEY = 20                      //页赛事列表缓存20秒
	OFFICIAL_LIVE_KEY            = "Official:Live"

	SPORT_LEAGUE_NAME_KEY        = "SPORT_LEAGUE_NAME_KEY" //热门赛事缓存KEY
	SPORT_LEAGUE_NAME_EXPIRY_KEY = 60                      //首页热门赛事缓存60秒

	SPORT_VIDEO_LINK_KEY        = "SPORT_VIDEO_LINK_KEY" //赛事视频源直播链接缓存
	SPORT_VIDEO_LINK_EXPIRY_KEY = 20                     //赛事视频源直播链接缓存20秒

	SPORT_VIDEO_VIEWER_KEY = "SPORT_VIDEO_VIEWER_KEY:" //赛事视频观看人数KEY

	IP_LIMITER_KEY = "IP_LIMITER_KEY:"
)
const (
	//'1-在线 2-进入后台（离开）3-通话中 9-离线'
	ACCOUNT_ONLINE_STATUS_ONLINE  = 1
	ACCOUNT_ONLINE_STATUS_AWAY    = 2
	ACCOUNT_ONLINE_STATUS_BUSY    = 3
	ACCOUNT_ONLINE_STATUS_OFFLINE = 9
	//0-正常 1封禁 DEFAULT '0' 2暂时冻结，时间到会解冻
	ACCOUNT_STATUS_NORMAL     = 0
	ACCOUNT_STATUS_BANNED     = 1
	ACCOUNT_STATUS_TMP_BANNED = 2
	ACCOUNT_STATUS_KICKED_OUT = 3 //被踢出，也要隔一段时间才能登陆
	ACCOUNT_DEACTIVED         = 4 //销户
	//0-未使用 1-已使用' DEFAULT '0'
	SMS_CODE_STATUS_FRESH = 0
	SMS_CODE_STATUS_USED  = 1
)

const DATA_NO_FOUND = "data no found"

const ( //消费类型
	CONSUME_GIFT             = 1
	CONSUME_YOULIAO          = 2
	CONSUME_EXCHANGE         = 3
	PROFIT_COMMISSION_GUILD  = 4
	PROFIT_COMMISSION_ANCHOR = 5
	PROFIT_DEPOSIT           = 6
	CONSUME_GAME_CHARGEIN    = 7
	PROFIT_GAME_CASHOUT      = 8
	CONSUME_OTHER            = 9
	PROFIT_TASK              = 10
	CONSUME_GUESS            = 11 //参与竞猜
	PROFIT_GUESS_WIN         = 12 //赢得奖金
	PROFIT_GUESS_RETURN      = 13 //退回订单
	CONSUME_GUESS_CANCEL_WIN = 14 //撤回奖金
	PROFIT_INVITE_REGISTER   = 15 //邀请注册（拉新）
	PROFIT_RECEIVE_NOBLE     = 16 //领取VIP
	PROFIT_REG_ACTIVITY      = 17 //注册活动
	SUBCRIBLE_NOBLE          = 18 //开通贵族
	WORLD_CUP_ORDER          = 19 //世界杯竞猜
	PROFIT_ADMIN_DEPOSIT     = 20 //管理员手动充值
	CONSUME_ADMIN_DEDUCT     = 21 //手动扣减
	PROFIT_WORLD_CUP         = 22 //世界杯竞猜
	CONSUME_LOTTERY_DRAW     = 23 //抽奖活动消费
	PROFIT_LOTTERY_AWARD     = 24 //抽奖活动奖励
	GAME_FRUIT_BET           = 25 //玩游戏

	LIVE_STORE_ORDER = 22  //商城订单
	PAYMENT          = 100 //充值

	// 1-消费礼物 2-鹰眼付费 3-货币转换 4-工会分成 5-主播分成(收礼物)
	// 6-钱包充值 7-转到游戏 8-从游戏中提款 9-其他 10-任务收入
	// 11-参与竞猜 12-赢得奖金 13-退回订单 14-撤回奖金 15-邀请注册 16领取vip 17 活动获得 20 手动充值 21 手动扣减 100充值
	// 22-抽奖活动花费 23-抽奖活动奖励
)
const (
	TYPE_CONSUME = 0
	TYPE_PROFIT  = 1
)

const ( //ES表名
	ES_CHAT_HISTORY  = "es_chat_history"
	ES_FUNDS_FLOW    = "es_funds_flow"
	ES_Anchor        = "es_anchor"
	ES_LiveRoom_Data = "es_live_room_data"
)
const (
	REDIS_ANCHOR_MANAGER_LIST = "REDIS_ANCHOR_MANAGER_LIST:%d" //这里放一个数组，每个节点是一个经纪人的分成情况，主播自己不算
	REDIS_ANCHOR_GUILD_RATE   = "REDIS_ANCHOR_GUILD_RATE:%d"   //这里放一个float64

)
const (
	FOOT_BALL_SPORT_ID    = 1            //1足球 id跟纳米数据保持一致
	BASKET_BALL_SPORT_ID  = 2            //2篮球
	CRICKET_BALL_SPORT_ID = 5            //5板球
	FOOT_BALL_SPORT_KEY   = "footBall"   //1足球
	BASKET_BALL_SPORT_KEY = "basketBall" //2篮球
)
const (
	MATCH_FOOTBALL_SCORE_CACHE_PRE   = "text_live:score_live.football:"   //足球比分结果redis key前缀
	MATCH_BASKETBALL_SCORE_CACHE_PRE = "text_live:score_live.basketball:" //蓝球比分结果redis key前缀
)
const (
	EXPERT_INDEX_MENU_CACHE_KEY        = "expert_index_menu_cache" //有料首页菜单缓存
	EXPERT_INDEX_MENU_CACHE_EXPIRY_KEY = 10                        //缓存时间5秒

)

/**
 * @author Aaron
 * @description 任务奖励类型
 * @createTime 13:17 2022/5/17
 **/
type RewardType uint8

const (
	REWARD_TYPE_EXP RewardType = iota //奖经验
	REWARD_TYPE_GOLD
	REWARD_TYPE_DIAMOND
	REWARD_TYPE_GIFT
	REWARD_TYPE_NOBLE_EXPERIENCE_DAY
	REWARD_TYPE_PROP
	REWARD_TYPE_LOTTERY_FREE_NUM
)
const (
	VALUE_MANAGER_RATE = 1
	VALUE_GIFT_PRICE   = 2
)
const (
	TOKEN_KICKED_OUT = "WALA_NA"     //被后台踢掉的用户的token会被置换掉，与清空和超时区别开
	TOKEN_GOOD_BYE   = " _FAREWELL_" //用户注销自己的账户
)

const GO_WEBAPI_CONFIGPUB = "go_webapi_ConfigPub"                             //系统常用环境变量
const GO_WEBAPI_CONFIGPUB_TICKET_SWITCH = "go_webapi_ConfigPub_Ticket_Switch" //系统常用环境变量
const GO_WEBAPI_CONFIGPUB_SEM = "go_webapi_ConfigPubSem"                      //系统常用环境变量
const GO_WEBAPI_CONFIGPUB_SEM_WEB = "go_webapi_ConfigPubSemWeb"               //系统常用环境变量
const GO_WEBAPI_CONFIGPUB_SPEC = "go_webapi_ConfigPubSpec"                    //特殊渠道包
const GO_WEBAPI_CONFIGPUB_JOYCIRCLE = "go_webapi_ConfigPubJoycircle"          //悦动圈渠道包
const GO_WEBAPI_CONFIG_SOURCE = "go_webapi_ConfigSource"                      //单独渠道配置
const GO_WEBAPI_CONFIGPRI = "go_webapi_ConfigPri"
const GO_WEBAPI_CHINACITY = "go_webapi_china_city"

const (
	////比赛状态,0-所有(默认),1-仅进行中的赛事,2-仅未开赛的赛事,3-仅完场的赛事(赛果),热门 777，收藏999
	DEF_MATCH_STATUS_ACTION = 1 // 定义比赛状态进行中
	DEF_MATCH_STATUS_FUTURE = 2 //未开赛
	DEF_MATCH_STATUS_DONE   = 3 //定义仅完场的赛事(赛果)
	//DEF_MATCH_STATUS_LIVE     = 555 //是否直播
	DEF_MATCH_STATUS_MATCH    = 666 // 定义赛程 未开赛的比赛以及异常赛事
	DEF_MATCH_STATUS_HOT      = 777 //定义热门 777
	DEF_MATCH_SEARCH          = 888 //赛事搜索
	DEF_MATCH_STATUS_FAVORITE = 999 //定义收藏999
	MATCH_IMPT                = 2   // 重要赛事
	DEF_MATCH_STATUS_ALL      = 0   //所有赛事(前端->即时)
)

const (
	ES_MATCH_FOOTBALL_SCORE   = "match_live_football_score"   //足球 es index名称
	ES_MATCH_BASKETBALL_SCORE = "match_live_basketball_score" //篮球es index名称
	ES_MATCH_CRICKET_SCORE    = "match_live_cricket_score"    //板球 es index名称
	ES_SEARCH_KEYWORD_ID      = "_id"                         //查询的关键字
	ES_SEARCH_TIME_OUT        = "5s"                          //ES 查询超时时间设置
)

const (
	SAND_BOX_URL        = "https://sandbox.itunes.apple.com/verifyReceipt" // (沙盒)链接
	PRODUCTION_URL      = "https://buy.itunes.apple.com/verifyReceipt"     //  (正式)链接
	REQUEST_URL_TIMEOUT = 15 * time.Second                                 // 请求接口超时时间
	PRODUCTION_URL_VAL  = 1                                                //生产
	SAND_BOX_URL_VAL    = 2                                                //沙盒
)

var ResponseStatusMsg = map[int64]string{
	21000: "App Store 的请求不是使用 HTTP POST 请求方法发出的。", //·21000 对 App Store 的请求不是使用 HTTP POST 请求方法发出的。
	21001: "App Store 不再发送此状态代码。",                 //·21001 App Store 不再发送此状态代码。
	21002: "属性中的数据receipt-data格式不正确或服务遇到临时问题。",    //·21002 属性中的数据receipt-data格式不正确或服务遇到临时问题。再试一次。
	21003: "无法验证收据。",                              //·21003 无法验证收据。
	21004: "您提供的共享密钥与您帐户的文件共享密钥不匹配。",              //·21004 您提供的共享密钥与您帐户的文件共享密钥不匹配。
	21005: "收据服务器暂时无法提供收据。",                       //·21005 收据服务器暂时无法提供收据。再试一次
	21006: "此收据有效，但订阅已过期。",                        //·21006 此收据有效，但订阅已过期。当此状态代码返回到您的服务器时，收据数据也会被解码并作为响应的一部分返回。仅针对自动续订订阅的 iOS 6 样式交易收据返回。
	21007: "这条回执是来自测试环境，但它是发送到生产环境进行验证的。",         //·21007 这条回执是来自测试环境，但它是发送到生产环境进行验证的。
	21008: "这条回执来自生产环境，但它被发送到测试环境进行验证。",           //·21008 这条回执来自生产环境，但它被发送到测试环境进行验证。
	21009: "内部数据访问错误。",                            //·21009 内部数据访问错误。稍后再试。
	21010: "用户帐户找不到或已被删除。",                        //·21010 用户帐户找不到或已被删除。
}

const (
	FAVORITE_SUBSCRIBE = 1 //1->收藏,
	FAVORITE_CANCEL    = 2 //2->取消收藏
)

const (
	//用户查询收入时用的业务代码
	REQ_INCOME_TYPE_GIFT    = 1          //礼物类
	REQ_INCOME_TYPE_GUESS   = 2          //竞猜类
	REQ_INCOME_TYPE_PAYMENT = 3          //充值
	REQ_INCOME_TYPE_TASK    = 10         //任务类
	REQ_INCOME_ADMIN        = 20         //管理员手动操作
	REGSOURCE_UNKNOWN       = "OFFICIAL" //未知的渠道
	EXPERT_LOGICIANS        = 0          //名家
	EXPERT_WIN              = 1          //专家胜率
	EXPERT_PROFIT           = 2          //专家回报
	EXPERT_SERIAL           = 3          //连红次数
	EXPERT_ATTENTION        = 4          //查询我关注的专家
)

const (
	EXPERT_ATTENTION_SUBSCRIBE = 1 //关注
	EXPERT_ATTENTION_CANCEL    = 2 //取消关注
)

const (
	BALL_CACHE_MATCHID   = "MatchId"
	BALL_CACHE_SPORTID   = "SportId"
	BALL_CACHE_AWAYSCORE = "AwayScore"
	BALL_CACHE_HOMESCORE = "HomeScore"
)

const (
	FINANCE_DEBIT  = 1 //借 收入
	FINANCE_CREDIT = 0 //贷 支出
)

const (
	PAY_SUCCESS    = 1 //支付成功
	PAY_FAIL       = 2 //支付失败
	RESULT_PAY_SUC = 0 //成功
)

const (
	//1-微信 2-支付宝 3-苹果支付 4-其他 5-人工
	PAY_CHANNEL_WECHAT = 1 //微信
	PAY_CHANNEL_ALPAY  = 2 //支付宝
	PAY_CHANNEL_APPLE  = 3 //苹果支付
	PAY_CHANNEL_OTHER  = 4 //其他
	PAY_CHANNEL_MANUAL = 1 //人工
)

const (
	TERMINAL_APPLE   = 1 //IOS
	TERMINAL_ANDROID = 2 //安卓
	TERMINAL_H5      = 3 //H5端
	TERMINAL_PC      = 0 //PC
)

const SQL_KEYWORK_AND = "and"

const (
	GRPC_ACCOUNT_SERVER_NAME    = "account_server"
	GRPC_LIVE_SERVER_NAME       = "live_server"
	GRPC_SPORT_SERVER_NAME      = "sport_server"
	GRPC_TASK_SERVER_NAME       = "task_server"
	GRPC_HONG_BAO_SERVER_NAME   = "hong_bao_server"
	GRPC_GUESS_SERVER_NAME      = "guess_server"
	GRPC_WS_SERVER_NAME         = "ws_server"
	GRPC_PAYMENT_SERVER_NAME    = "payment_server"
	GRPC_TENCENT_IM_SERVER_NAME = "tencent_im_server"
	GRPC_GAMES_SERVER_NAME      = "games_server"

	GRPC_ACCOUNT_SERVER_NAME_KEY    = "grpc.account_server_name"
	GRPC_LIVE_SERVER_NAME_KEY       = "grpc.live_server_name"
	GRPC_SPORT_SERVER_NAME_KEY      = "grpc.sport_server_name"
	GRPC_TASK_SERVER_NAME_KEY       = "grpc.task_server_name"
	GRPC_HONG_BAO_SERVER_NAME_KEY   = "grpc.hong_bao_server_name"
	GRPC_GUESS_SERVER_NAME_KEY      = "grpc.guess_server_name"
	GRPC_WS_SERVER_NAME_KEY         = "grpc.ws_server_name"
	GRPC_PAYMENT_SERVER_NAME_KEY    = "grpc.payment_server_name"
	GRPC_TENCENT_IM_SERVER_NAME_KEY = "grpc.tencent_im_server_name"
	GRPC_GAMES_SERVER_NAME_KEY      = "grpc.games_server_name"

	GRPC_MICROSERVICE_VERSION = "0.0.1"
)
const (
	TENCENT_IM_SDK_APP_ID                = 20002096                                                           //im 产品ID
	TENCENT_IM_SECRET_KEY                = "d4ba3e2f6828911743a2b0873c78c0f13c5ed43873f7029527061091fbf4ca51" //im产品密钥
	TENCENT_IM_ACCOUNT_EXPIRE_TIME       = 31536000                                                           //365天
	TENCENT_IM_UNREALACCOUNT_EXPIRE_TIME = 604800                                                             //7天
)

// 聊天室缓存key
const (
	REDIS_LIVE_STATISTIC_ANCHOR = "statisticsGroup_%d"
	STREAM_RDS_KEY              = "STREAM:KEY:%d" //redis流名的key
	CHAT_HISTORY                = "chathistory:%d"
	Speak_Room_KEY              = "speakRoom:"
	Room_Total_User             = "room_total_user:"
	Ip_Count                    = "ip_count:"
)
const (
	USER_TASK_KEY = "USER:TASK:%d:%d" //用户:task的redis key

)

const (
	NormalActivityType = 0 //无送活动，紧显示列表
	RegActivityType    = 1 //注册送活动
)
const (
	PAYMENT_CACHE_PRE         = "payment:"
	PAYMENT_CACHE_EXPIRY_TIME = 1800     //30分钟
	PAYMENT_HSQ_CODE          = "HSQ"    //慧收钱
	PAYMENT_ALI_CODE          = "ALIPAY" //慧收钱
)
const (
	//DYNAMIC_ALL:支付宝、微信、云闪付 DYNAMIC_ALPAY：支付宝  DYNAMIC_WECHAT：微信  DYNAMIC_UNION:云闪付
	HSQ_DYNAMIC_ALL    = "DYNAMIC_ALL"    //支付宝、微信、云闪付
	HSQ_DYNAMIC_ALPAY  = "DYNAMIC_ALPAY"  //支付宝
	HSQ_DYNAMIC_WECHAT = "DYNAMIC_WECHAT" //微信
	HSQ_DYNAMIC_UNION  = "DYNAMIC_UNION"  //云闪付
	HSQ_NATIVE_WECHAT  = "WECHAT_APP"     //微信
	HSQ_NATIVE_ALI     = "ALI_APP"
)

// 比赛状态转换为中文
var RawMatchStatusToZh = map[int32]map[int32]string{
	1: {0: "比赛异常",
		1:  "未开赛",
		2:  "上半场",
		3:  "中场",
		4:  "下半场",
		5:  "加时赛",
		6:  "加时赛(弃用)",
		7:  "点球决战",
		8:  "完场",
		9:  "推迟",
		10: "中断",
		11: "腰斩",
		12: "取消",
		13: "待定"},
	2: {0: "比赛异常",
		1:  "未开赛",
		2:  "第一节",
		3:  "第一节完",
		4:  "第二节",
		5:  "第二节完",
		6:  "第三节",
		7:  "第三节完",
		8:  "第四节",
		9:  "加时",
		10: "完场",
		11: "中断",
		12: "取消",
		13: "延期",
		14: "腰斩",
		15: "待定"},
}

var RawMatchStatusToCustom = map[int32]map[int32]int32{
	1: {0: 2,
		1:  2,
		2:  1,
		3:  1,
		4:  1,
		5:  1,
		6:  1,
		7:  1,
		8:  3,
		9:  4,
		10: 4,
		11: 4,
		12: 4,
		13: 4},
	2: {0: 2,
		1:  2,
		2:  1,
		3:  1,
		4:  1,
		5:  1,
		6:  1,
		7:  1,
		8:  1,
		9:  1,
		10: 3,
		11: 4,
		12: 4,
		13: 4,
		14: 4,
		15: 4},
}

const (
	//这里要和tencentIm里的同步
	CHAT_ROOM_HISTORTY_KEY = "chathistory:%d"
)

var PAY_CHANNEL_MAP = map[string]string{
	"1": "微信",
	"2": "支付宝",
	"3": "苹果支付",
	"4": "其他",
	"5": "人工",
}
var PAY_STATUS_MAP = map[string]string{
	"0": "等待支付",
	"1": "支付成功",
	"2": "支付取消",
	"3": "支付失败",
}
var PAY_TERMINAL_MAP = map[string]string{
	"1": "IOS",
	"2": "Android",
	"3": "pc",
}

const MSG_NOT_FOUND = "not found"

const (
	PAYMENT_PREFIX_IOS = "IOS"
	PAYMENT_PREFIX_HSQ = "HSQ"
	PAYMENT_PREFIX_ALI = "ALI"
)

const BLOCK_LIST_GIFT_KEY = "block:list:gift"
const JSON_KEY = "ADKOPSTF" //8位

const (
	SYNC_LIVE_DB_REDIS_KEY = "models_live:record"
)

const (
	LOGIN_PLATFORM_WEB     = 0
	LOGIN_PLATFORM_IOS     = 1
	LOGIN_PLATFORM_ANDROID = 2
	LOGIN_PLATFORM_H5      = 3
)

const (
	GiftPriceTypeDiamond = iota + 1 // 钻石
	GiftPriceTypeClara              // 宝石
)

type Field string

const (
	// 接口统计
	RoomStatsActiveViewer = "active_viewer" // 活跃观众
	RoomStatsViewerCount  = "viewer_count"  // 总人数
	//  埋点统计
	PopMsgCount                    Field = "pop_msg_count"            // 弹幕消息
	RoomStatsSpeakCount            Field = "speak_count"              // 发言人数
	RoomStatsGiftTotalPrice        Field = "gift_total_price"         // 礼物总价值
	RoomStatsGiftTotalNum          Field = "gift_total_num"           // 礼物总数
	RoomStatsGiftDiamondTotalPrice Field = "gift_diamond_total_price" // 鹰钻价值
	RoomStatsGiftDiamondTotalNum   Field = "gift_diamond_total_num"   // 鹰钻总数
	RoomStatsHot                   Field = "hot"                      // 热度
	UniqueIpCount                  Field = "unique_ip_count"          // 用户IP数
	//  其他统计
	RoomStatsBarrageTimeCount Field = "barrage_time_count" // 最高在线
)

const (
	LIVE_PLAN_STATUS_INTEND   = 0
	LIVE_PLAN_STATUS_LIVING   = 1
	LIVE_PLAN_STATUS_FINISHED = 2
	LIVE_PLAN_STATUS_CANCELED = 3
)

// 动作统计记录
const (
	ACTION_GUESS_TO_LOGIN = "ACTION_GUESS_TO_LOGIN_"
)

const (
	ThumbCropUrl   = "imageMogr2/thumbnail/"
	PCThumbSize    = "432x240"
	MobileThumSize = "432x240" //直播封面

	PCNewsBannerSize    = "900x506"
	PCNewsListThumbSize = "232x130"
	MobileBannerSize    = "384x216"
	MobileListThumbSize = "232x130"
)

// 语言
const (
	LangChinese = "zh_cn"
	LangEnglish = "en"
	LangKorean  = "ko"
	LangVi      = "vi"
	LangThTw    = "zh_tw"
	LangId      = "id"
)

// IP统计
const (
	GlobalCount         = "global_ip_count:%s"           // 全局统计数量（按天统计IP数量）
	GlobalIpSet         = "global_ip:%s"                 // 全局统计集合（按天统计IP数量）
	GlobalLiveRoomCount = "global_live_room_ip_count:%s" // 全局进直播间统计数量（按天统计IP数量）
	GlobalLiveRoomIpSet = "global_live_room_ip:%s"       // 全局进直播间统计集合（按天统计IP数量）
)

const (
	EsSeoIPLimit = "EsSeoIPLimit:%s" // 同IP限制es访问次数
)

const (
	LiveWatchDevice         = "live_watch_device"          // 直播观看设备
	LiveWatchUpdateList     = "live_watch_update_list"     // 直播更新记录
	LiveWatchChannelStat    = "live_watch_channel_stat"    // 直播渠道统计
	LiveWatchChannelStat_V2 = "live_watch_channel_stat_v2" // 直播渠道统计
)

const (
	FetchUrlSaveHash = "fetch_url_save_hash" //爬虫图片转储后存放
)

const (
	IM_LOGIN_RECORD       = "IM_LOGIN_RECORD:%s"
	IM_LOGIN_RECORD_SET   = "IM_LOGIN_RECORD_SET:%s"
	IM_LOGIN_RECORD_COUNT = "IM_LOGIN_RECORD_COUNT:%s"
)

const (
	LONGMEN_ANDROID_APP_CHANNEL = "NJRD561S"
	LiveCategoryReplayType      = 100
)
